package we3d.filter 
{
	import flash.display.BitmapData;
	import flash.filters.BlurFilter;
	import flash.filters.BitmapFilterQuality;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import we3d.View3d;
	
	public class SLBlur extends BackgroundFilter 
	{
		public function SLBlur () {}
		
		public var p:Point = new Point(0,0);
		private var bf:BlurFilter = new BlurFilter(2, 2, 1);
		
		public function get blurX () :int {
			return bf.blurX;
		}
		public function set blurX (v:int) :void {
			bf.blurX = v;
		}
		
		public function get blurY () :int {
			return bf.blurY;
		}
		public function set blurY (v:int) :void {
			bf.blurY = v;
		}
		
		public function get blurQuality () :int {
			return bf.quality;
		}
		public function set blurQuality (v:int) :void {
			bf.quality = v;
		}
		
		public override function endFrame (view:View3d) :void {
			
			var lyrs:Array;
			
			if(layers == null) {
				lyrs = view.allLayers;
			}else{
				lyrs = layers;
			}
			
			if(lyrs) {
				var L:int = lyrs.length;
				var i:int;
				var bmp:BitmapData;
				
				for(i=0; i<L; i++) {
					bmp = lyrs[i].bmp;
					if(bmp) {
						bmp.applyFilter(bmp, bmp.rect, p, bf);
					}
				}
			}
		}
		
	}
}